﻿@using STX.Domain
@model STX.Domain.BizActivity
@{
    Layout = null;

    var isShowOperation = false;
    
    STX.Domain.TabAdministrator user = ViewBag.CurUser;
    var mystep = Model.Step;
    var fieldInfo = mystep.GetType().GetField(mystep.ToString());
    var attrUsers = fieldInfo.GetCustomAttributes(typeof(MyUserAttribute), false);
    if (attrUsers.Length >= 1)
    {
        var attrUser = attrUsers[0] as MyUserAttribute;
        if (attrUser != null)
        {
            isShowOperation = (attrUser.Role & user.Position) > 0;
        }
    }
    if (!isShowOperation)
    {
        return;
    }
    var attrUrls = fieldInfo.GetCustomAttributes(typeof(UrlActionAttribute), false);
    if (attrUrls.Length <= 0)
    {
        return;
    }
    var attrUrl = attrUrls[0] as UrlActionAttribute;
    if (attrUrl == null)
    {
        return;
    }

    if (mystep == StepEnum.总经理审核增减成本 && Model.Auditing == AuditingEnum.审核成功)
    {
        return;
    }
}

<a href="@Url.Action(attrUrl.Action, new { id = Model.Id })" target="dialog" width="1250" 
                                           height="500" backtype="html" refreshonclose="true">@attrUrl.Text</a>
